import { getAuthDepartmentsFn } from '@/pages/commodity/modules/utils/salePriceRequireUtils';
import { PRODUCT_TYPE_OPTIONS } from '@/constants/commodity';
// 商品类型
export const PRODUCT_TYPES = PRODUCT_TYPE_OPTIONS
// 图文完善状态
export const PIC_STATUS = [
  {
    value: 'INIT',
    label: '待完善'
  },
  {
    value: 'ADDING',
    label: '完善中'
  },
  {
    value: 'ADD_OK',
    label: '已完善'
  }
]
// 待完善列表表头
export const initPerfectColumns = (parent) => {
  return [
    {
      title: 'SPU编码',
      key: 'spuNo',
      fixed: 'left'
    },
    {
      title: '商品名称',
      key: 'productName',
      fixed: 'left'
    },
    {
      title: '分类',
      key: 'categoryPath',
      width: 200
    },
    {
      title: '品牌',
      key: 'brandName',
      width: 80
    },
    {
      title: '创建人',
      key: 'createOperName'
    },
    {
      title: '创建人部门',
      key: 'createOperDeptName'
    },
    {
      title: '商品类型',
      key: 'productTypeStr',
      width: 70
    },
    {
      title: '归属部门',
      render: (h, { row }) => <div>{ getAuthDepartmentsFn(row) }</div>
    },
    {
      title: '管理区域',
      key: 'manageAreaName',
      width: 80
    },
    {
      title: '创建日期',
      key: 'createOpeTime'
    },
    {
      title: '商品SKU信息(包装)',
      key: 'packageAddState',
      width: 130,
      render: (h, { row }) => {
        if (row.packageAddState && parent.showBtn('SKU信息')) {
          return (
            <el-link
              type = { parent.formatLinkType(row.packageAddState) }
              onClick = {() => parent.handleLinkJump(row, 'skuPackageInfo', row.packageAddState)}
            >
              { row.packageAddStateStr }
            </el-link>
          );
        }
        return '';
      }
    },
    {
      title: '供货信息',
      key: 'supplyPriceAddState',
      width: 80,
      render: (h, { row }) => {
        if (row.supplyPriceAddState && parent.showBtn('供货信息')) {
          return (
            <el-link
              type = { parent.formatLinkType(row.supplyPriceAddState) }
              onClick = {() => parent.handleLinkJump(row, 'skuSupplyInfo', row.supplyPriceAddState)}
            >
              { row.supplyPriceAddStateStr }
            </el-link>
          );
        }
        return '';
      }
    },
    {
      title: '售价信息',
      key: 'salePriceAddState',
      width: 80,
      render: (h, { row }) => {
        if (row.salePriceAddState && parent.showBtn('售价信息')) {
          return (
            <el-link
              type = { parent.formatLinkType(row.salePriceAddState) }
              onClick = {() => parent.handleLinkJump(row, 'skuPriceInfo', row.salePriceAddState)}
            >
              { row.salePriceAddStateStr }
            </el-link>
          );
        }
        return '';
      }
    },
    {
      title: '图文介绍',
      key: 'picAddState',
      width: 80,
      render: (h, { row }) => {
        if (row.picAddState && parent.showBtn('图文信息')) {
          return (
            <el-link
              type = { parent.formatLinkType(row.picAddState) }
              onClick = {() => parent.handleLinkJump(row, 'skuImgTextInfo', row.picAddState)}
            >
              { row.picAddStateStr }
            </el-link>
          );
        }
        return '';
      }
    },
    {
      title: '验收标准',
      key: 'acceptanceAddState',
      width: 80,
      render: (h, { row }) => {
        if (row.acceptanceAddState && parent.showBtn('验收标准')) {
          return (
            <el-link
              type = { parent.formatLinkType(row.acceptanceAddState) }
              onClick = {() => parent.handleLinkJump(row, 'skuCheckInfo', row.acceptanceAddState)}
            >
              { row.acceptanceAddStateStr }
            </el-link>
          );
        }
        return '';
      }
    },
    {
      title: '资质信息',
      key: 'qualificationAddState',
      width: 80,
      render: (h, { row }) => {
        if (row.qualificationAddState && parent.showBtn('资质')) {
          return (
            <el-link
              type = { parent.formatLinkType(row.qualificationAddState) }
              onClick = {() => parent.handleLinkJump(row, 'skuQualificationInfo', row.qualificationAddState)}
            >
              { row.qualificationAddStateStr }
            </el-link>
          );
        }
        return '';
      }
    }
  ]
}
